package collection

import "fmt"

func ArrayTest() {
	var nameArray [3]string = [3]string{}
	fmt.Println(nameArray)

	var nameArray2 = [3]string{"a", "b", "c"}
	fmt.Println(nameArray2)

	ageArray := [3]int{1, 2, 3}
	fmt.Println(ageArray)

	dyncArray := [...]float64{1.1, 2, 3}
	fmt.Println(len(dyncArray), dyncArray)

	pcArray := [3]string{"a", "b", "c"}
	fmt.Println(pcArray[1])
	pcArray[2] = "lenovo"
	//数组不能自动扩容
	//pcArray[3] = "lenovo"
	fmt.Println(pcArray)

	for i := 0; i < len(pcArray); i++ {
		fmt.Println(pcArray[i])
	}

	for key, value := range pcArray {
		fmt.Println(key, value)
	}
}
